//
//  UIBarButtonItem+extension.swift
//  swft_weibo
//
//  Created by mac on 15/9/10.
//  Copyright © 2015年 mac. All rights reserved.
//

import UIKit

extension UIBarButtonItem{

    class func barButtonItem(image:String,selectedImage:String,action:Selector,target:AnyObject)->UIBarButtonItem{
    
            let btn=UIButton()
            btn.addTarget(target, action: action, forControlEvents: UIControlEvents.TouchUpInside)
            btn.setImage(UIImage(named: image), forState: UIControlState.Normal)
            btn.setImage(UIImage(named: selectedImage), forState: UIControlState.Highlighted)
            btn.sizeToFit()
            let barButtonItem=UIBarButtonItem(customView: btn)
        
            return barButtonItem
    }


}